#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_clicked()
{
    QPixmap pixmap = QPixmap::grabWindow( QApplication::desktop()->winId(), pos().x(), pos().y(), frameGeometry().width(), frameGeometry().height() );

        pixmap.save("a.bmp","bmp");
        QMessageBox::information(this,"OK","saved as a.bmp",QMessageBox::Ok);



}

void MainWindow::on_pushButton_2_clicked()
{
    QPixmap pixmap = QPixmap::grabWidget(this);

        pixmap.save("b.bmp","bmp");
        QMessageBox::information(this,"OK","saved as b.bmp",QMessageBox::Ok);

}
